package com.chuji.crmcj.view;

import android.app.Dialog;
import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.View;

import com.chuji.crmcj.R;

/**
 * Created by y.yiwen on 1/12/2016.
 */
public class BigHeadImageDialog extends Dialog {
    private int FLAG_DISMISS = 1;
    //判断是否显示
    private boolean flag = true;
    private Context context;
//    private Handler mHandler = new Handler() {
//        @Override
//        public void handleMessage(Message msg) {
//            super.handleMessage(msg);
//            if (msg.what == FLAG_DISMISS)
//                dismiss();
//        }
//
//    };
//    /**
//     * 线程控制消失时间
//     */
//    private Thread mThread = new Thread() {
//        @Override
//        public void run() {
//            super.run();
//            while (flag) {
//                try {
//                    Thread.sleep(2000);
//                    Message msg = mHandler.obtainMessage();
//                    msg.what = FLAG_DISMISS;
//                    mHandler.sendMessage(msg);
//                } catch (InterruptedException e) {
//                    e.printStackTrace();
//                }
//            }
//        }
//    };

    public BigHeadImageDialog(Context context) {
        super(context, R.style.BigHeadImageDialog);
        //加载布局文件
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View view = inflater.inflate(R.layout.head_image_dialog, null);
        //dialog添加视图
        setContentView(view);
    }
    /**
     * 显示
     */
    @Override
    public void show() {
        super.show();
    }
    /**
     * 消失
     */
    @Override
    public void dismiss() {
        super.dismiss();
        flag = false;
    }
}
